home *** CD-ROM | disk | FTP | other *** search
- Path: dt1.datatamers.com!hawke
- From: hawke@dt1.datatamers.com (Carlos Urrutia)
- Newsgroups: comp.lang.c
- Subject: Re: What the hell is THIS?!
- Date: 16 Jan 1996 01:03:12 GMT
- Organization: none
- Message-ID: <4detgg$ir7@news.datatamers.com>
- References: <4d6rgh$rfu@abel.cc.sunysb.edu> <coc-1301960253420001@dal1498.computek.net>
- NNTP-Posting-Host: dt1.datatamers.com
-
- In article <coc-1301960253420001@dal1498.computek.net>,
- Chad Cranfill <coc@computek.net> wrote:
- >In article <4d6rgh$rfu@abel.cc.sunysb.edu>, bmadhusu@engws12.ic.sunysb.edu
- >(Bommasamudram Madhusudan) wrote:
- >
- >> Can someone explain what
- >>
- >> int (*p)[3] is?????
- >>
- >
- >Starting with the "p", we parse the expression thusly: "p is an array of 3
- >pointers to int". If you need help with this (believe me, I did!) get the
- actually, its "p is a pointer to array 3 of int". for it to be an array of
- pointers to int, it'd have to be declared as int *p[3].
-
- >book "Deep C Secrets". It presents an algorithmic method for decoding
- >statements like this, and gives hints on how to implement a C program that
- >will do this for you.
- funny, thats one of my course books for the advanced c programming class im
- taking :)
-
- >
- >>
- >> I can say things like:
- >>
- >> (*p)[0] = 3; for e.g, but when I print the value using:
- >>
- >> printf("%d",(*p)[0]) I get a core dump!
- >
- >Instead of using the dereference operator here, you may want to just say:
- >
- >printf("%d", p[0]);
- >
- >This just seems to be the intuitive way to do this, but since I haven't
- >tried this example I could be wrong.
- >
- >--Chad
-
- carlos
-